<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="invCierreSearch" styleClass="edit">

        <rich:simpleTogglePanel label="Filtro de busqueda de cierre" switchType="ajax">

      <s:decorate template="layout/display.xhtml">
           <ui:define name="label">Bodega:</ui:define>
<h:selectOneMenu value="#{invCierreList.invCierre.auxsubDep}"
    defaultLabel="Seleccione..." 
                directInputSuggestions="true"
                enableManualInput="false" 
>

<f:selectItems value="#{grupoListado.listadoBusquedaBodegaSelectItems}"  />
</h:selectOneMenu>
</s:decorate>
        </rich:simpleTogglePanel>

        <div class="actionButtons">
            <h:commandButton id="search" value="Buscar" action="/InvCierreList.xhtml"/>
            <s:button id="reset" value="Limpiar" includePageParams="false"/>
        </div>

    </h:form>

    <rich:panel>
        <f:facet name="header">Resultado de Busqueda</f:facet>
    <div class="results" id="invCierreList">

    <h:outputText value="No hay resultado de busqueda."
               rendered="#{empty invCierreList.resultList}"/>

    <rich:dataTable id="invCierreList"
                var="_invCierre"
              value="#{invCierreList.resultList}"
           rendered="#{not empty invCierreList.resultList}">
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{invCierreList}"/>
                    <ui:param name="propertyLabel" value="Identificador"/>
                    <ui:param name="propertyPath" value="invCierre.crrCodigo"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_invCierre.crrCodigo}"/>
        </h:column>
        
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{invCierreList}"/>
                    <ui:param name="propertyLabel" value="FEcha"/>
                    <ui:param name="propertyPath" value="invCierre.crrFecha"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_invCierre.crrFecha}">
                <s:convertDateTime type="date" pattern="MM/dd/yyyy"/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{invCierreList}"/>
                    <ui:param name="propertyLabel" value="Unidad"/>
                    <ui:param name="propertyPath" value="invCierre.crrUnidades"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_invCierre.crrUnidades}">
                <f:convertNumber/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{invCierreList}"/>
                    <ui:param name="propertyLabel" value="Items"/>
                    <ui:param name="propertyPath" value="invCierre.invItemStock.itemSecuenca"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_invCierre.invItemStock.iteNombre}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{invCierreList}"/>
                    <ui:param name="propertyLabel" value="Bodega"/>
                    <ui:param name="propertyPath" value="invCierre.subdepartamento.subdepCodigo"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_invCierre.subdepartamento.descripcion}"/>
        </h:column>
        <rich:column styleClass="action">
            <f:facet name="header">Accion</f:facet>
            <s:link view="/#{empty from ? 'InvCierre' : from}.xhtml"
                   value="#{empty from ? 'Ver' : 'Seleccionar'}"
             propagation="#{empty from ? 'none' : 'default'}"
                      id="invCierre">
                <f:param name="invCierreCrrCodigo"
                        value="#{_invCierre.crrCodigo}"/>
            </s:link>
            #{' '}
            
        </rich:column>
    </rich:dataTable>

    </div>
    </rich:panel>

    <div class="tableControl">

        <s:link view="/InvCierreList.xhtml"
            rendered="#{invCierreList.previousExists}"
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>

        <s:link view="/InvCierreList.xhtml"
            rendered="#{invCierreList.previousExists}"
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult"
                    value="#{invCierreList.previousFirstResult}"/>
        </s:link>

        <s:link view="/InvCierreList.xhtml"
            rendered="#{invCierreList.nextExists}"
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult"
                    value="#{invCierreList.nextFirstResult}"/>
        </s:link>

        <s:link view="/InvCierreList.xhtml"
            rendered="#{invCierreList.nextExists}"
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult"
                    value="#{invCierreList.lastFirstResult}"/>
        </s:link>

    </div>

    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/InvCierreEdit.xhtml"
                    id="create"
           propagation="none"
                 value="Crear cierre">
            <f:param name="invCierreCrrCodigo"/>
        </s:button>
    </s:div>

</ui:define>

</ui:composition>
